Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

checksum-stream

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

checksum-stream

Calculates and/or checks data coming through a stream and emits the digest before stream end.

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
37
decreased by-64.76%
Maintainers
1
Weekly downloads
 
Created
Source

checksum-stream npm version license Travis AppVeyor Coverage Status

checksum-stream is a passthrough stream that calculates the digest and size for data piped through it. Before closing, it will emit digest and size events with the final stream size.

It can also be configured to error if digest or size do not matched a passed-in value that is expected for either or both. size errors will always be emitted first.

Install

$ npm install --save checksum-stream

Example

npm repo

const checksumStream = require('checksum-stream')
const fs = require('fs')
const request = require('request')

let req = request.get('https://npm.im/checksum-stream')
req.on('response', function (res) {
  res.pipe(
    checksumStream({
      algorithm: 'sha256',
      digest: res.headers['etag'],
      size: res.headers['content-length']
    }).on('error', e => throw e)
  ).pipe(
    fs.createWriteStream('./checksum-stream.html')
  )
})

Keywords

FAQs

Package last updated on 21 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc